package com.youhp.spire.xls.demo.Charts.ManipulateChart;

import com.spire.xls.Workbook;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;

public class ChartToImage {

    public static void main(String[] args) throws IOException {

        Workbook workbook = new Workbook();
        //Load file from disk
        workbook.loadFromFile("data/ChartToImage.xlsx");

        //Save chart as image
        BufferedImage image= workbook.saveChartAsImage(workbook.getWorksheets().get(0), 0);
        ImageIO.write(image,"png",new File("output/ChartToImage.png"));

    }
}
